package com.authstr.auth.mapper.inter;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.authstr.auth.constant.CacheName;
import com.authstr.auth.constant.CacheKey;
import com.authstr.model.base.BaseRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;


@Mapper
public interface RoleDao extends BaseMapper<BaseRole> {
    Page query(@Param("page") Page page, String name);

    List<Map> getAll(String name, String exclude_id);

    List<BaseRole> getLikeParentIds(Long id);

    List<Long> getRoleIdByUserId(Long userId);

    List<String> getRoleNameByUserId(Long userId);

    @Cacheable(value = CacheName.SHIRO_CACHE ,key = "'" + CacheKey.ROLES_BY_USERID_ + "'+#userId")
    List<Map<String,Object>> getRoleIdAndNameByUserId(Long userId);


}
